from tkinter import*

root =Tk()

def callback():
    print('1')
menubar =Menu(root,tearoff=False)


fillmenubar1 =Menu(menubar,tearoff=False)
fillmenubar1.add_command(label='one',command=callback)
fillmenubar1.add_separator() 
menubar.add_cascade(label='Hello',menu=fillmenubar1)


fillmenubar2 =Menu(menubar,tearoff=False)
fillmenubar2.add_command(label='two',command=root.quit)
menubar.add_cascade(label='Quit',menu=fillmenubar2)

root.config(menu=menubar)

frame1 = Frame(root,width=100,height=200,background='blue')
frame1.pack()
def popup1(event):
    fillmenubar1.post(event.x_root,event.y_root)
frame1.bind('<Button-1>',popup1)

frame2 = Frame(root,width=100,height=200,background='yellow')
frame2.pack()
def popup2(event):
    fillmenubar2.post(event.x_root,event.y_root)
frame1.bind('<Button-3>',popup2)


mainloop()
